# -*- coding: utf-8 -*-
"""
@ Created on 2024-06-14 12:23
---------
@summary: 字典项表单模型
---------
@author: Lsaiah
"""

from pydantic import BaseModel, Field
from typing import Optional


class DictItemCreateRequest(BaseModel):
    """字典项创建请求"""
    dict_type_id: int = Field(..., description="字典类型ID")
    label: str = Field(..., description="字典项标签", max_length=100)
    value: str = Field(..., description="字典项值", max_length=100)
    description: Optional[str] = Field(None, description="字典项描述", max_length=200)
    is_active: bool = Field(True, description="是否激活")
    sort_order: int = Field(0, description="排序")


class DictItemUpdateRequest(BaseModel):
    """字典项更新请求"""
    id: int = Field(..., description="字典项ID")
    dict_type_id: Optional[int] = Field(None, description="字典类型ID")
    label: Optional[str] = Field(None, description="字典项标签", max_length=100)
    value: Optional[str] = Field(None, description="字典项值", max_length=100)
    description: Optional[str] = Field(None, description="字典项描述", max_length=200)
    is_active: Optional[bool] = Field(None, description="是否激活")
    sort_order: Optional[int] = Field(None, description="排序")
